package com.woniuxy.food.app.apiImpl;

import cn.hutool.core.bean.BeanUtil;
import com.woniuxy.cloud.mall95.log.Log;
import com.woniuxy.food.client.foodskupicclient.FoodSkuPicQueryClient;
import com.woniuxy.food.client.result.FoodSkuPicClientDto;
import com.woniuxy.food.service.FoodSkuPicService;
import com.woniuxy.food.service.servicedto.FoodSkuPicServiceDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import result.Result;

import java.util.List;

@RestController
public class FoodSkuPicQueryClientApiImpl implements FoodSkuPicQueryClient {

    @Autowired
    private FoodSkuPicService foodSkuPicService;
    @Override
    @Log("根据菜品skuID查询图片")
    public Result<List<FoodSkuPicClientDto>> searchFoodSkuPic(Integer skuId) {
        List<FoodSkuPicServiceDto> foodSkuPicServiceDtos = foodSkuPicService.searchFoodSkuPic(skuId);
        List<FoodSkuPicClientDto> foodSkuPicClientDtos = BeanUtil.copyToList(foodSkuPicServiceDtos, FoodSkuPicClientDto.class);
        return Result.success(foodSkuPicClientDtos);
    }
}
